package com.lipaluma.examples.annotation.customer;

import org.joda.time.DateTime;

import com.lipaluma.annotations.adaptors.standard.Trim;
import com.lipaluma.annotations.adaptors.standard.Truncate;
import com.lipaluma.annotations.mapping.MapColumn;
import com.lipaluma.annotations.validations.Validate;
import com.lipaluma.annotations.validations.ValidateDate;
import com.lipaluma.annotations.validations.ValidateInteger;
import com.lipaluma.csv.annotations.config.CSV;

@CSV(delimiter=';', quote='"', hasHeader=true, mapColumnsByHeaders=true)
public class Customer {
	@ValidateInteger(unique=true)
	private Long id;
	
	@Trim
	private String name;

	@Trim
	private String firstname;

	private Address address;

	@MapColumn(pattern="yyyy-MM-dd")
	@ValidateDate(after="1980-01-01", pattern="yyyy-MM-dd")
	private DateTime birthday;
	
	@Validate(matches=".*@.*\\..*")
	private String email;

	@MapColumn(trueValues="1")
	private boolean active;
	
	@Trim
	private double salary;

	@Trim
	@Truncate(at=30, suffix="...")
	private String comments;
	
	public Long getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public String getFirstname() {
		return firstname;
	}

	public Address getAddress() {
		return address;
	}

	public DateTime getBirthday() {
		return birthday;
	}

	public String getEmail() {
		return email;
	}

	public boolean isActive() {
		return active;
	}

	public double getSalary() {
		return salary;
	}
	
	public String getComments() {
		return comments;
	}
}
